<?php
/**
 * JoiEditor - Joostina WYSIWYG Editor
 *
 * Backend content viewer. Config-page.
 *
 * @version 1.0 beta 3
 * @package JoiEditor
 * @subpackage	Admin
 * @filename config.php
 * @author JoostinaTeam
 * @copyright (C) 2008-2010 Joostina Team
 * @license see license.txt
 *
 **/

defined('_VALID_MOS') or die();
		
		$acl = &gacl::getInstance();
		
		$gtree = array();
		
		$gtree = $acl->get_group_children_tree(null, 'USERS', false); 
		$gtree[0] = mosHTML::makeOption('0','---');
		
		if(!defined('_JQUERY_LOADED')) {
			define('_JQUERY_LOADED',1);
			$mainframe->addJS($mainframe->getCfg('live_site').'/includes/js/jquery/jquery.js');				
		}
		$mainframe->addJS($mainframe->getCfg('live_site').'/administrator/components/com_joieditor/js/jquery-ui-1.7.2.custom.min.js');
		$mainframe->addJS($mainframe->getCfg('live_site').'/administrator/components/com_joieditor/js/admin_script.js');
		
		$mainframe->addCSS($mainframe->getCfg('live_site').'/administrator/components/com_joieditor/css/admin_style.css');
		$mainframe->addCSS($mainframe->getCfg('live_site').'/components/com_joieditor/core/themes/advanced/skins/default/ui.css');
				
		$tabs = new mosTabs(1, 1);
?>
		<script language="javascript" type="text/javascript">
			function submitbutton(pressbutton) {
				var form = document.adminForm;
				if (pressbutton == 'cancel') {
					submitform( pressbutton );
					return;
				}

				
				<?php if ($isNew ): ?>
					if  (form.gid.value == "") {
						alert( "<?php echo _C_JOIEDITOR_ENTER_GROUP_PLEASE ?>" );
					}
					else if (form.gid.value == "29") {
						alert( "<?php echo _C_JOIEDITOR_BAD_GROUP_1 ?>" );
					}
					else if (form.gid.value == "30") {
						alert( "<?php echo _C_JOIEDITOR_BAD_GROUP_2 ?>" );
					} 
				<?php endif; ?>
				
				else {
					submitform( pressbutton );
				}


			}
		</script>
		<form action="index2.php" method="post" name="adminForm" id="adminForm">
		
		<table class="adminheading">
			<tr><th class="config">JoiEditor - <?php echo _C_JOIEDITOR_ADMIN_CONFIG ?>  [<?php echo ($isNew ?  $list['components'] :  $this->_subgroup);  ?>]</th></tr>
		</table>

		<?php $tabs->startPane("config"); ?>

			<?php $tabs->startTab(_C_JOIEDITOR_ADMIN_MAIN_CONFIG, "config0"); ?>
			<table class="paramlist" width="100%">
				
				<?php if ($isNew ): ?>
					<tr>
						<th class="key"><?php echo _C_JOIEDITOR_ADMIN_USERGROUP;?>:</th>
						<td><?php echo mosHTML::selectList($gtree, 'gid', 'size="1"', 'value', 'text'); ?></td>
					</tr>
				<?php endif; ?>
				
					<tr>
						<th class="key"><?php echo _C_JOIEDITOR_ADMIN_LANG;?></th>
						<td>
							<?php echo mosHTML::selectList($list['langs'], 'language', 'class="inputbox"', 'value', 'text', $this->language); ?>
						</td>
					</tr>
					
					<tr>
						<th class="key"><?php echo _C_JOIEDITOR_ADMIN_THEME;?></th>
						<td>
							<?php echo mosHTML::selectList($list['themes'], 'theme', 'class="inputbox"', 'value', 'text', $this->theme); ?>
						</td>
					</tr>
					
					<tr>
						<th class="key"><?php echo _C_JOIEDITOR_ADMIN_PLUGINS;?></th>
						<td><?php echo $list['plugins']; ?></td>
					</tr>
					
					<tr>
						<th class="key"><?php echo _C_JOIEDITOR_ADMIN_WIDTH;?></th>
						<td><input size="100" class="inputbox" type="text" name="width" style="width:50px;" value="<?php echo $this->width; ?>" /></td>
					</tr>
					
					<tr>
						<th class="key"><?php echo _C_JOIEDITOR_ADMIN_HEIGHT;?></th>
						<td><input size="100" class="inputbox" type="text" name="height" style="width:50px;" value="<?php echo $this->height; ?>" /></td>
					</tr>
					
					<tr>
						<th class="key"><?php echo _C_JOIEDITOR_ADMIN_TOOLBAR_POSITION;?></th>
						<td>
							<?php echo mosHTML::selectList($list['toolbar_location'], 'theme_advanced_toolbar_location', 'class="inputbox"', 'value', 'text', $this->theme_advanced_toolbar_location); ?>
						</td>
					</tr>
					
					<tr>
						<th class="key"><?php echo _C_JOIEDITOR_ADMIN_TOOLBAR_ALIGN;?></th>
						<td>
							<?php echo mosHTML::selectList($list['toolbar_align'], 'theme_advanced_toolbar_align', 'class="inputbox"', 'value', 'text', $this->theme_advanced_toolbar_align); ?>
						</td>
					</tr>
					
					<tr>
						<th class="key"><?php echo _C_JOIEDITOR_ADMIN_STATUSBAR_POSITION;?></th>
						<td>
							<?php echo mosHTML::selectList($list['statusbar_location'], 'theme_advanced_statusbar_location', 'class="inputbox"', 'value', 'text', $this->theme_advanced_statusbar_location); ?>
						</td>
					</tr>
					
					<tr>
						<th class="key"><?php echo _C_JOIEDITOR_ADMIN_RESISE;?></th>
						<td>
						<?php echo mosHTML::radioList($list['resizing'], 'theme_advanced_resizing', 'class="inputbox"', $this->theme_advanced_resizing, 'value', 'text'); ?>
						</td>
					</tr>
					
					<tr>
						<th class="key"><?php echo _C_JOIEDITOR_ADMIN_RESISE_HOR;?></th>
						<td>
						<?php echo mosHTML::radioList($list['resizing_hor'], 'theme_advanced_resize_horizontal', 'class="inputbox"', $this->theme_advanced_resize_horizontal, 'value', 'text'); ?>
						</td>
					</tr>
				</table>			
				<?php $tabs->endTab(); ?>
			
			<?php $tabs->startTab(_C_JOIEDITOR_ADMIN_BUTTONS, "config1"); ?>
				<table class="paramlist" width="100%">
					<tr>
						<th class="key">-</th>
						<td>
							<?php echo _C_JOIEDITOR_ADMIN_BUTTONS_ORDER;?><br /><?php echo _C_JOIEDITOR_ADMIN_BUTTONS_ORDER_INFO;?>
							
							<br /><br /><br />
							
							<ul id="buttons1_row" class="defaultSkin mce_buttons r"></ul>	
							<ul id="buttons2_row" class="defaultSkin mce_buttons r"></ul>
							<ul id="buttons3_row" class="defaultSkin mce_buttons r"></ul>
							<ul id="buttons4_row" class="defaultSkin mce_buttons r"></ul>
							
							<br /><br />
													
							<input type="hidden" class="buttons1_row" id="buttons1" name="buttons1" value="<?php echo $this->theme_advanced_buttons1;?>" />
							<input type="hidden"  class="buttons2_row" id="buttons2" name="buttons2" value="<?php echo $this->theme_advanced_buttons2;?>" />
							<input type="hidden" class="buttons3_row" id="buttons3" name="buttons3" value="<?php echo $this->theme_advanced_buttons3;?>" />
							<input type="hidden" class="buttons4_row" id="buttons4" name="buttons4" value="<?php echo $this->theme_advanced_buttons4;?>" />
							
							
							<?php echo $list['buttons1']; ?>
						
						</td>
					</tr>
				</table>
			<?php $tabs->endTab(); ?>
			
		
			<?php $tabs->startTab(_C_JOIEDITOR_ADMIN_IM_CONFIG, "config6"); ?>
				<table class="paramlist" width="100%">
					<tr>
						<th class="key"><?php echo _C_JOIEDITOR_ADMIN_IM_ROOT_DIR;?></th>
						<td><input size="100" class="inputbox" type="text" name="image_manager_dir" value="<?php echo $this->image_manager_dir; ?>" /></td>
					</tr>
					<tr>
						<th class="key"><?php echo _C_JOIEDITOR_ADMIN_IM_OWN_DIR;?></th>
						<td>
						<?php echo mosHTML::yesnoRadioList('image_manager_owndir', 'class="inputbox"', $this->image_manager_owndir); ?>
						</td>
					</tr>					
					<tr>
						<th class="key"><?php echo _C_JOIEDITOR_ADMIN_IM_DOWNLOAD_IMG;?></th>
						<td>
						<?php echo mosHTML::yesnoRadioList('im_download_img', 'class="inputbox"', $this->im_download_img); ?>
						</td>
					</tr>
					
					<tr>
						<th class="key"><?php echo _C_JOIEDITOR_ADMIN_IM_DEL_IMG;?></th>
						<td>
						<?php echo mosHTML::yesnoRadioList('im_del_img', 'class="inputbox"', $this->im_del_img); ?>
						</td>
					</tr>
					
					<tr>
						<th class="key"><?php echo _C_JOIEDITOR_ADMIN_IM_RENAME_IMG;?></th>
						<td>
						<?php echo mosHTML::yesnoRadioList('im_rename_img', 'class="inputbox"', $this->im_rename_img); ?>
						</td>
					</tr>
					
					<tr>
						<th class="key"><?php echo _C_JOIEDITOR_ADMIN_IM_CREATE_DIR;?></th>
						<td>
						<?php echo mosHTML::yesnoRadioList('im_create_dir', 'class="inputbox"', $this->im_create_dir); ?>
						</td>
					</tr>
					
					<tr>
						<th class="key"><?php echo _C_JOIEDITOR_ADMIN_IM_DEL_DIR;?></th>
						<td>
						<?php echo mosHTML::yesnoRadioList('im_del_dir', 'class="inputbox"', $this->im_del_dir); ?>
						</td>
					</tr>
					
					<tr>
						<th class="key"><?php echo _C_JOIEDITOR_ADMIN_IM_CROP;?></th>
						<td>
						<input size="5" style="width:50px;" class="inputbox" type="text" name="im_width_to_link" value="<?php echo $this->im_width_to_link; ?>" /> X <input size="5" style="width:50px;" class="inputbox" type="text" name="im_height_to_link" value="<?php echo $this->im_height_to_link; ?>" /> px
						</td>
					</tr>
					
				</table>			
			<?php $tabs->endTab(); ?>
			
			
	<?php $tabs->endPane(); ?>

			<input type="hidden" name="option" value="<?php echo $option; ?>" />
			<input type="hidden" name="task" value="save_config" />
			<?php if (!$isNew ): ?><input type="hidden" name="group" value="<?php echo $this->_subgroup; ?>" /><?php endif; ?>
			<input type="hidden" name="<?php echo josSpoofValue(); ?>" value="1" />
		</form>